//
//  ReviewTableViewCell.m
//  Streaming
//
//  Created by 官琛 on 15-6-23.
//  Copyright (c) 2015年 liuxun. All rights reserved.
//

#import "ReviewTableViewCell.h"

@implementation ReviewTableViewCell



-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatTable];
    }
    return self;

}

-(void)creatTable
{
    self.ca = [[UILabel alloc]initWithFrame:CGRectMake(60, 10, 100, 20)];
    [self.contentView addSubview:self.ca];
    self.ca.textColor = [UIColor lightGrayColor];
    self.ca.font = [UIFont systemFontOfSize:14];
    [_ca release];
    
    self.caimg = [[UIImageView alloc]initWithFrame:CGRectMake(10, 40, 40, 40)];
    [self.contentView addSubview:self.caimg];
    self.caimg.layer.masksToBounds = YES;
    self.caimg.layer.cornerRadius = 20;
    [_caimg release];

    self.ce = [[UILabel alloc]initWithFrame:CGRectMake(70, 30, 230, 80)];
    [self.contentView addSubview:self.ce];
    self.ce.numberOfLines = 0;
    self.ce.font = [UIFont systemFontOfSize:13];
    [_ce release];
    
    self.cal = [[UILabel alloc]initWithFrame:CGRectMake(320, 70, 80, 30)];
    [self.contentView addSubview:self.cal];
    [_cal release];
    
    self.cr = [[UILabel alloc]initWithFrame:CGRectMake(300, 20, 80, 30)];
    [self.contentView addSubview:self.cr];
    [_cr release];
    
}


-(void)setRev:(Review *)rev
{
    if (_rev != rev) {
        [_rev release];
        _rev = [rev retain];
    }
    self.ca.text = rev.ca;
    NSURL *url = [NSURL URLWithString:rev.caimg];
    [self.caimg sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"12346.jpg"]];
    self.ce.text = rev.ce;
    self.cal.text = rev.cal;
    NSInteger str = rev.cr;
    self.cr.text = [NSString stringWithFormat:@"评分:%ld",str];
    

}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
